<?php
include_once ('../lib/YepSua/Labs/RIA/jQuery4PHP/YsJQueryAutoloader.php');
YsJQueryAutoloader::register();

require_once("../functions/sesion.class.php");

$sesion = new sesion();
$usuario = $sesion->get("usuario");

if( $usuario == false )
{
	header("Location: login.php");
}
else
{
?>
<!DOCTYPE html>
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title></title>
        
        <link rel="stylesheet" type="text/css" href="../css/styles.css" />  
        <link rel="stylesheet" type="text/css" href="../css/jquery-ui-1.7.2.custom.css" />
        <link rel="stylesheet" type="text/css" href="../css/demo_table.css" />
        <link rel="stylesheet" type="text/css" href="../css/uploadify.css" />
		<script type="text/javascript" src="../js/jquery.1.7.2.js"></script>
		<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.7.2/jquery-ui.min.js"></script>
        <script type="text/javascript" src="../js/util.js"></script>
        <script type="text/javascript" src="../js/jquery.dataTables.js" charset="utf-8"></script>
        <script type="text/javascript" src="../js/jquery.uploadify.min.js" charset="utf-8"></script>
        <script type="text/javascript" src="../js/functions.js" charset="utf-8"></script>
        <script type="text/javascript" src="../js/parse.js"></script>
        
    </head>
    <body>
        
        <div class="container border">
            <div class="header">
                
            </div>
            <div class="cssmenu border">
                <ul>
                    <li class='active'><a href='search-notifications.php'><span>Notificaciones</span></a></li>
                    <li class='last'><a href='#' onclick="initCreateNotification();"><span>Crear notificación</span></a></li>
                    <li style="float: right;" class='last'><a href="../functions/cerrarsesion.php" ><span>Cerrar sesión</span></a></li>
                </ul>
            </div>
            <div class="content">
                <!-- ================== FORMULARIO DE BUSQUEDA ==================== -->
                <fieldset class="fieldset border fieldset-search">
                    <legend class="title">Filtros de búsqueda</legend>
                <form method="post" id="formSearch">
                    <table>
                        <tr>
                            <td>
                                <div class="field">
                                    <span  class="name">Nombre</span>
                                    <input id="filtername" name="name" class="value inputText" required>
                                </div>
                            </td>
                            <td>
                                <div class="field">
                                    <span class="name">Estado</span>
                                    <select class="value select" id="filterstate">
                                        <option value="0">Seleccione</option>
                                        <option value="1">Pendiente</option>
                                        <option value="2">Enviada</option>
                                    </select>
                                </div>
                            </td>
                        </tr>
                        <tr>
                            <td>
                                <div class="field">
                                    <span class="name">Fecha inicial</span>
                                    <input type="text" name="datepicker" id="filterdateinitial" 
                                           class="datepicker value date" readonly="readonly" size="12" />
                                </div>
                            </td>
                            <td>
                                <div class="field">
                                    <span class="name">Fecha final</span>
                                    <input type="text" name="datepicker" id="filterdatefinal" 
                                           class="datepicker value date" readonly="readonly" size="12" />
                                </div>
                            </td>
                        </tr>
                    </table>
                </form>
                </fieldset>
                
                <button class="ui-button ui-widget ui-state-default ui-corner-all buttonSearch button" 
                        type="button" id="searchButton">Buscar</button>
                <br>
                <!-- ================== RESULTADOS BUSQUEDA ==================== -->
                <div id="divNotifications"  style="display:none">
                <fieldset class="fieldset border">
                    <legend class="title">Notificaciones encontradas</legend>
                    <br>
                    <div id="notifications">
                    
                    </div>
                </fieldset> 
                </div>
                <br><br>
                <!-- ================== DIV ENVIAR NOTIFICACION ==================== -->
                <div id="divSendNotification" class="sendNotifications border popup" style="display:none">
                    <div class="titleDiv">Enviar notificación</div>
                    <fieldset class="fieldset">
                        <legend class="title">Datos de envío</legend>
                        <br>
                        <table>
                        <tr>
                            <td>
                                <div class="field">
                                    <span  class="name">Notificación</span>
                                    <div id="notificationNameSend" class="value inputText withoutSpace"></div>
                                </div>
                            </td>
                            <td>
                               <div id="divCities"></div> 
                            </td>
                        </tr>
                        </table>
                         <br>
                    </fieldset> 
                    <div class="buttonsCenter">
                        <button class="ui-button ui-widget ui-state-default ui-corner-all button" type="button" id="buttonCancelSend" >Cancelar</button>  
                        <button class="ui-button ui-widget ui-state-default ui-corner-all button" 
                        	type="button" id="buttonSend" onclick="sendNotification();">Enviar</button>  
                    </div>
                    
                </div>
                <!-- ================== DIV CREAR/MODIFICAR NOTIFICACION ==================== -->
                <div id="divNotificationData" class="divNotificationData border popup"  style="display:none">
                    <div class="titleDiv" id="titleDivCreateModifyNotification">Crear notificación</div>
                    <fieldset class="fieldset">
                        <legend class="title">Datos de Notificación</legend>
                    <table>
                        <tr>
                            <td>
                                <div class="field">
                                    <span  class="name">Nombre *</span>
                                    <input id="notificationNameData" name="fieldNotificationData" class="value inputText" required>
                                </div>
                            </td>
                            <td>
                                <div class="field">
                                    <span class="name">Lugar *</span>
                                    <input id="notificationPlaceData" name="fieldNotificationData" class="value inputText" required>
                                </div>
                            </td>
                        </tr>
                        <tr>
                            <td>
                                <div class="field">
                                    <span  class="name">Fecha *</span>
                                    <input type="text" name="fieldNotificationData" id="notificationDateData" 
                                           class="datepicker value date" readonly="readonly" size="12" />
                                </div>
                            </td>
                            <td>
                                <div class="field">
                                    <span class="name">Hora *</span>
                                    <input id="notificationHourData" name="fieldNotificationData" class="value inputText" required>
                                </div>
                            </td>
                        </tr>
                        <tr>
                            <td>
                            <div class="field">
                                <span class="name">Imagen *</span>
                                <input type="file" name="file_upload" id="file_upload" />
                            </div>
                            </td>    
                        </tr>
                    </table>
                            
                    </fieldset> 
                    <div class="buttonsCenter">
                        <button class="ui-button ui-widget ui-state-default ui-corner-all button" type="button" 
                                id="buttonCancelSend" onclick="hideDiv('divNotificationData');">Cancelar</button>  
                        <button class="ui-button ui-widget ui-state-default ui-corner-all button" 
                                type="button" id="buttonCreate" onclick="createNotification();">Crear</button>
                        <button class="ui-button ui-widget ui-state-default ui-corner-all button" 
                                type="button" id="buttonModify" onclick="modifyNotification();">Modificar</button>          
                    </div>
                </div>
            </div>
        
        </div>
        
    </body>
</html>
<?php 
	}	
?>